
import config


class RegisterLoginApi:


    #在初始化方法里面 ,定义session参数
    def __init__(self,session):
        self.session = session


    #获取图⽚验证码接口-封装
    def get_image_code_api(self,r):
        url = config.Host+f"/common/public/verifycode1/{r}"
        result = self.session.get(url=url)
        return result

    #获取短信验证码接口-封装
    def get_phone_code_api(self,data):
        url = config.Host+"/member/public/sendSms"
        header = {"Content-Type":"application/x-www-form-urlencoded"}
        resp = self.session.post(url=url,headers=header,data=data)
        return resp

    #注册接口-封装
    def get_register_api(self,register_data):
        url = config.Host+"/member/public/reg"
        header = {"Content-Type": "application/x-www-form-urlencoded"}
        resp = self.session.post(url=url,headers=header,data=register_data)
        return resp


    #登录接口-封装
    def get_login_api(self,data={"keywords": "15900001123", "password": "qs1234"}):
        url = config.Host+"/member/public/login"
        header = {"Content-Type":"application/x-www-form-urlencoded"}
        resp = self.session.post(url=url,headers=header,data=data)
        return resp

    #查询是否登录接口-封装
    def get_login_verify_api(self):
        url = config.Host+"/member/public/islogin"
        resp = self.session.post(url=url)
        return resp

